package com.youtills.resource;

/**
 * TODO - !!!doc me!!!
 *
 * @author ravi.chiluveru
 * @since 23.0 (8/15/14)
 */
public final class ResourceRelationshipValueBak<L extends Resource, R extends Resource>{

    /*

    private final ResourceRelationship<L, R> resourceRelationship;
    private Integer resourceId;
    private String orderValue;

    static abstract class Builder<T, E extends Builder> {

        private Resource resource;
        private Relationship<T> relationship;
        private boolean nullable;
        private boolean immutable;

        public Resource getResource() {
            return resource;
        }

        public E setResource(Resource resource) {
            this.resource = resource;
            return (E)this;
        }

        public Relationship<T> getRelationship() {
            return relationship;
        }

        public E setRelationship(Relationship<T> relationship) {
            this.relationship = relationship;
            return (E)this;
        }

        public boolean isNullable() {
            return nullable;
        }

        public E setNullable(boolean nullable) {
            this.nullable = nullable;
            return (E)this;
        }

        public boolean isImmutable() {
            return immutable;
        }

        public E setImmutable(boolean immutable) {
            this.immutable = immutable;
            return (E)this;
        }
    }

    public ResourceRelationshipValueBak(Builder builder) {

        assert (builder.resource != null ) : "resource cannot be null.";
        assert (builder.relationship != null ) : "attribute cannot be null.";

        this.resource = builder.resource;
        this.relationship = builder.relationship;
        this.nullable = builder.nullable;
        this.immutable = builder.immutable;

        if(resource instanceof BaseResource) {
            ((BaseResource)resource).addRelationship(this);
        }
    }

    public String getName() {
        return relationship.getRelationshipName();
    }

    public boolean isNullable() {
        return nullable;
    }

    protected Resource getResource() {
        return resource;
    }

    public Relationship getRelationship() {
        return relationship;
    }

    public boolean isModified() {
        return modified;
    }

    protected void setModified(boolean modified) {
        this.modified = modified;
    }

    public boolean isImmutable() {
        return immutable || resource.isImmutable();
    }

    @Override
    public String toString() {
        return String.valueOf(this.value);
    }
    */
}
